package com.jerry.mingxing.ui.message;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by Administrator on 2016/8/31.
 */
public class MessagerViewPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> totallist;
    private String []titles;


    public MessagerViewPagerAdapter(FragmentManager fm, List<Fragment> totallist, String[] titles) {
        super(fm);
        this.totallist = totallist;
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return totallist.get(position);
    }

    @Override
    public int getCount() {
        return totallist.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position%titles.length];
    }
}
